﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace WaterMarker
{
    public partial class Options : Form
    {
        public Options()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                WaterMarker.x = float.Parse(txtX.Text);
                WaterMarker.y = float.Parse(txtY.Text);
                WaterMarker.waterMarkString = rtbWaterText.Text;
                this.Close();
            }
            catch
            {
                MessageBox.Show("Parameters was invalidate, please check your input!", "Error");
            }

        }

        private void button2_Click(object sender, EventArgs e)
        {
            string path=AppDomain.CurrentDomain.BaseDirectory+"resource\\preview.jpg";
            button1_Click(null, null);
            try
            {
                Image previewImg = WaterMarker.MarkImage(path);
                Preview.previewImg = previewImg;
                Preview previewForm = new Preview();
                previewForm.ShowDialog();
            }
            catch
            { }
            

        }
    }
}
